#include<bits/stdc++.h>
using namespace std;

const int N = 2e5 + 10;
int n, last = -1, num, a[N];
queue<int> g[N];

int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d", &n);
	for(int i=1;i<=n;i++){
		scanf("%d", &a[i]);
		if(a[i] != last)	num++, g[num].push(i);
		else	g[num].push(i);
	}
	while(1){
		bool flag = 0;
		for(int i=1;i<=num;i++){
			for(int j=0;j<g[i].size();j++){
				cout << g[i].front() << ' ';
				g[i].pop();
			}
			if(!g[i].empty())	flag = true;
		}
		if(!flag)	break;
	}
	return 0;
}
